package com.kj.platformlogistics.home.adapter;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.kj.platformlogistics.R;
import com.kj.platformlogistics.home.model.SolicilationedModel;

import java.util.List;

public class SoliciLationedAdapter extends BaseQuickAdapter<SolicilationedModel.ResultDTO.PageDTO, BaseViewHolder> {

    public SoliciLationedAdapter(@Nullable List<SolicilationedModel.ResultDTO.PageDTO> data) {
        super(R.layout.item_wait_solicilation, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SolicilationedModel.ResultDTO.PageDTO item) {

        ImageView ivSelected=helper.getView(R.id.ivSelected);
        helper.addOnClickListener(R.id.ivSelected);
        helper.setText(R.id.tvStatus,"已揽件");
        helper.setText(R.id.tvNumber,item.getNum()+"");
        helper.setText(R.id.tvPostAddress,item.getMailAddress());
        helper.setText(R.id.tvPostName,item.getMailName());
        helper.setText(R.id.tvPostPhone,item.getMailPhone());
        helper.setText(R.id.tvOrderNumber,"订单号："+item.getWaybillNumber());

        if (item.getShow()==null){
            item.setShow(false);
        }
        if (item.getSelected()==null){
            item.setSelected(false);
        }
        if (item.getShow()){
            ivSelected.setVisibility(View.VISIBLE);
            if (item.getSelected()){
                ivSelected.setImageResource(R.mipmap.icon_selected_dot);
            }else {
                ivSelected.setImageResource(R.mipmap.icon_unselected_dot);

            }
        }else {
            ivSelected.setVisibility(View.GONE);
        }
    }
}
